import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/celery-shop/shop/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/celery-shop/shop/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/celery-shop/shop/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/celery-shop/shop/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/celery-shop/shop/submit',
    method: 'post',
    data: row
  })
}

export const auth = (code) => {
  return request({
    url: '/api/celery-shop/shop/auth',
    method: 'post',
    params: {
      code,
    }
  })
}

export const authByAliId = (aliId) => {
  return request({
    url: '/api/celery-shop/shop/auth-by-aliid',
    method: 'post',
    params: {
      aliId,
    }
  })
}

export const registerByAliId = (aliId, account, password) => {
  return request({
    url: '/api/celery-shop/shop/register-by-aliid',
    method: 'post',
    params: {
      aliId,
      account,
      password,
    }
  })
}

export const sync = (id) => {
  return request({
    url: '/api/celery-shop/shop/sync',
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 店铺选择接口
 */
export const shopSelect = () => {
  return request({
    url: '/api/celery-shop/shop/shop_select',
    method: 'get',
    params: {}
  })
}

